<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="三联表单" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
    <!--<input name="id" value="" type="hidden">-->

    <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>

    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "文件名称"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <input class="form-control" name="title"  type="text"  >
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "文件描述"/>：</label>
                <div class="col-sm-8">
                    <input name="descript" class="form-control"  type="text" required>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "请选择文件"/>：</label>
                <div class="col-sm-8">
                    <input type="file" id="file" name="url"/>
                </div>
            </div>
        </div>
        <div class="col-sm-6">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "归类"/>：</label>
                <div class="col-sm-8">
                    <!--<input name="status" class="form-control" value=""  type="text" required>-->
                    <@f.select name="kind" dictType="sys_source_kind" blankValue="0" blankLabel="所有"/>
                </div>
            </div>
        </div>
    </div>
</div>


</@f.form>
<div class="hr-line-dashed"></div>
<div class="row" style="text-align: center;" id="_addTab">

    <button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
    <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
</div>
</div>
<@footer>
<script type="text/javascript">
    var prefix = baseURL + "bpm/information";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if (opt.validate.form()) {
            console.log($('#task-form-complete').serialize())
            opt.operate.saveTab(prefix + "/add", $('#task-form-complete').serialize());
        }
    }

    /*上传视频资料文件*/
    $("#file").change(function () {
        uploadFile();
    });
    function uploadFile() {
        var oFiles = document.getElementById("file").files;
        console.log(oFiles);
        var formdata = new FormData();
        formdata.append("file", oFiles[0]);
        console.log(formdata)
        opt.common.sendAjax({
            url: prefix + "/doUploadFile",
            data: formdata,
            type: "POST",
            processData: false,
            contentType: false,
            success: function(result) {
                console.log(result);
            }
        })
    }

</script>
</@footer>
</@pageTheme>